import { createUpperNamespace } from '@/utils/create'
import { App } from 'vue'

import Counter from './Counter'

const components = [Counter] //TODO #1 组件添加处

const install = (app: App) => {
  components.forEach((component) => {
    app.component(component.name, component)
    app.component(createUpperNamespace(`-${component.name}`), component)
  })
}

export { Counter } //TODO #2 组件导出

export type { CounterProps } from './Counter' //TODO #3 组件内部所有类型需要导出供外部使用，注意添加type关键字，这点非常重要

export default { install }
